package org.rcloud.io.controller;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiOperation;
import org.rcloud.io.Utils.ResultVo;
import org.rcloud.io.model.User_Article;
import org.rcloud.io.service.User_ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2019/1/30.
 */
@RestController
@RequestMapping(value = "/api")
public class User_ArticleController {

    @Autowired
    private User_ArticleService user_articleService;

    /*
        保存文章id信息
     */
    @ApiOperation(value="保存信息", notes="保存信息")
    @ResponseBody
    @RequestMapping(value = "/saveinfo", produces = {"application/json;charset=UTF-8"})
    public ResultVo save(@RequestBody String params){
        String reg = JSON.parseObject(params).getString("collect");
        User_Article user_article = JSON.parseObject(reg, User_Article.class);
        return user_articleService.save(user_article);

    }

    /**
     *  根据文章id查询
     */
    /*@ApiOperation(value="根据文章id查询", notes="根据文章id查询")
    @ResponseBody
    @RequestMapping(value = "/getinfo", produces = {"application/json;charset=UTF-8"})
    public  User_Article getUA(){

    }*/
}
